import userMenu from './template/userMenu.vue';

import footNav from '@/components/footerNav.vue';
import tab from '@/pages/members/template/tab.vue';
import landlordRent from './template/landlordRent.vue';
import landlordRent0 from './template/landlordRent0.vue';
import{MessageBox} from 'mint-ui';
export default {
  name:'',
  data:() => ({
    userInfo:'',
    isLogin:false,
    leaseTab:['长租房源','短租房源'],
    idx:0,
    topdivHeight:0,
  }),
  mounted() {
    //do something after mounting vue instance
    let that = this;
    this.$nextTick( () => {
      network.get(configUrl.QUERYUSER_URL,'',function(res){
        console.log(res);
        if(res.code==401){
          MessageBox.alert('授权过期，请重新登录').then(action => {
              that.$router.push({name:'login'});
            }).catch(err=>{
              console.log(err);
            });
        }
        that.isLogin = true;
        that.userInfo = res.data;
      },function(err){
        console.log(err);
      });
    });

    console.log(that.$refs.topDiv.offsetHeight);
    let topdivHeight = that.$refs.topDiv.offsetHeight+20;
    that.$refs.bottomDiv.style.top = topdivHeight+'px';
    that.topdivHeight = topdivHeight;
  },
  components: {
    userMenu,
    landlordRent,
    landlordRent0,
    footNav,
    tab,
  },
  methods: {
    toLogin() {   //跳转去登录
      this.$router.push({path:'/login'});
    },
    toMemberset() {   //个人信息设置
      if (this.isLogin) {
        this.$router.push({path:'/memberSet'});
      }else {
        this.$router.push({path:'/login'});
      }
    },
    tabActive(data){
      console.log(data);
      this.idx = data.idx;
    },
  }
}
